Skip to main content

All Questions

Tagged with
7votes
1answer
179views

Readable unit test - lists of complex objects

Goal: Writing more readable tests. I have a couple of functions, which basically merge and converts two lists of Datasets together, written using Scala and Spark. Each of these Datasets has a lot of ...
Aidin's user avatar
5votes
1answer
264views

Scala Docx generator from CSV input, using the docx4j library and Scala Swing

I am working on an application which takes as input a CSV file containing a list of attributes and a .docx template containing variable names equal to the columns ...
Claudius's user avatar
5votes
1answer
249views

Bowling game Kata in Scala - pattern match

This is a functional approach to problem described by standard Bowling Game Kata - to implement the rules of calculating a score in a bowling game. The inspiration was the implementation by Uncle Bob: ...
Sebastian Kramer's user avatar
2votes
1answer
1kviews

Hamming distance in Scala

Problem Write a program that can calculate the Hamming difference between two DNA strands. GAGCCTACTAACGGGAT CATCGTAATGACGGCCT ^ ^ ^ ^ ^ ^^ Code ...
CodeYogi's user avatar
2votes
1answer
990views

Anagram in Scala

Code ...
CodeYogi's user avatar
5votes
3answers
189views

Nucleotide count in Scala

This is my second day in learning Scala and I still need to develop a taste of functional programming, I often find myself doing imperative coding. Below is the result of my TDD practice. Code ...
CodeYogi's user avatar
6votes
2answers
618views

String Calculator Kata in Scala

This is my solution of string calulator kata in scala(i'm new of tdd). I'd like a general review of this. String Calculator Create a simple String calculator with a method int Add(string ...
Marco's user avatar
4votes
1answer
302views

White box input stream for creating test scenarios

I need to test a specialized input stream class that takes input from a TCP/IP network connection. I particularly need to ensure that the blocking and availability behavior is correct. To help me ...
Donald.McLean's user avatar
5votes
1answer
432views

Safe cracker string with all combinations

Imagine a safe with a 4-digit code, and accepting a continuous stream of code entries, such that when the 4 digits are seen in the right sequence, the safe opens. Generate a short string that contains ...
janos's user avatar
  • 112k
4votes
1answer
323views

Find minimum number of coins (count and list of coins too)

For a given set of denominations, you are asked to find the minimum number of coins with which a given amount of money can be paid. Assume that you can use as many coins of a particular denomination ...
janos's user avatar
  • 112k
11votes
2answers
5kviews

Sqrt (square root) function

As an exercise in learning Scala, I implemented a square root function like this: ...
janos's user avatar
  • 112k
5votes
2answers
3kviews

Reading and parsing CSV files

This is my first real attempt at a Scala program. I come from a predominantly Java background, so I'd like to know if the program sticks to Scala conventions well. Is it well readable or should it ...
Athas's user avatar
3votes
0answers
924views

Testing Scala code which depends on objects

I am writing a small oauth2 library for Play! 2.1 scala. As I am still learning I got stuck trying to TDD and ended up writing the code first, then refactoring for testability. By testability I mean ...
Jean's user avatar
  • 528
16votes
1answer
591views

TDD and function injection

I'm trying to come up with a scalable way of TDD'ing my Scala code, in particular managing dependencies. In this example, I've TDD'd part of the classic river crossing problem where we have people on ...
Geoff's user avatar

close